#ifndef WRITEATTACK_MAINWIN_H
#define WRITEATTACK_MAINWIN_H

#include <deque>

#include <QtWidgets/QMainWindow>
#include <QtCore/QTimer>

#include "ui_WriteAttack.h"

class WriteAttackMainWin : public QMainWindow, private Ui_WriteAttackMainWin
{
	Q_OBJECT
	
	public:
		WriteAttackMainWin( QWidget *parent = NULL );

		void startWriting();

		void lockDown();
		void unlockDown();		

		void startTimer();
		void resetTimer();

		QAction *getQuitAction() { return actionQuit; }

protected:
	int timeLimit; // in minutes
	int secondsLeft;

	// Mascot moods
	enum {
		Mascot_IDLE,
		Mascot_ATTACK,
		Mascot_HAPPY,
		Mascot_OUCH,
		Mascot_DEAD
	};

	QTimer timerCountdown;
	QTimer timerUpdateMascotAnim;

	int frame;
	int mascotIndex;
	int mascotMood;
	char mascotName[100];
	
	bool isBurning;
	
	
	static const int mascotFrames[12][10];
	bool needsReset;
	bool success;

	std::deque<float> wordCountHistory;

	virtual void keyPressEvent( QKeyEvent *event );
		
public slots:
		void updateWordCount();
		void updateTick();

		void updateAnim();

		void doSave();
		void doTimerButton();

		void doSetTargets();

		void onBurnComplete();
		void about();
};

#endif
